JBoss Community Archive (Read Only)

PicketLink

PicketLink IDM - User Management - Passwords

Passwords

User instances will need to deal with passwords.  PicketLink IDM defines these as credentials. There are methods on the IdentityManager interface to update and validate credentials.  We describe these scenarios below.

Majority of the Passwords are character based.  This is why PicketLink IDM provides a Password class.

The IdentityManager does have the ability to take in multiple Credential objects such as Password.  You will need an appropriate CredentialHandler if you use your own form of credential other than Password etc.

Update or Set a Password on an User Instance

If an User is being created for the for the first time, you have to add it to the IdentityManager before updating the credential as follows.

User user = new SimpleUser(userName);
user.setEmail(request.getEmail());
user.setFirstName(request.getFirstName());
user.setLastName(request.getLastName());

user.setAttribute( new Attribute<String>("address", request.getAddress()) );

user.setAttribute( new Attribute<String>("city", request.getCity()) );

user.setAttribute( new Attribute<String>("state", request.getState()) );
user.setAttribute( new Attribute<String>("postalCode", request.getPostalCode()) );
user.setAttribute( new Attribute<String>("country", request.getCountry()) );

//Add the User into the store
identityManager.add(user);

//Now update the credential
identityManager.updateCredential(user, new Password(request.getPassword()));
JBoss.org Content Archive (Read Only), exported from JBoss Community Documentation Editor at 2020-03-11 12:19:15 UTC, last content change 2013-01-16 17:45:54 UTC.